#!/usr/bin/env python

from page_manager_class import PageManager

def list ( liwe ):
	"""
	:INPUT:

	:PERMS:
		- create:		With this permission you can create/modify

	"""

	tp = PageManager ( liwe )
	return { "pages" : tp.list () }

def create ( liwe, text, id_page = 0, module= '', page_name = '' ):
	"""
	:INPUT:
		- text:		SAFE_HTML
		- id_page:	SAFE_NUMBER [0]
		- module:	SAFE_DB_STRING
		- page_name:	SAFE_STRING

	:xPERMS:
		- create:		With this permission you can create/modify
	"""
	tp = PageManager ( liwe )
	id_page = tp.add ( text = text, id_page = id_page, module = module, page_name = page_name )

	return { "id_page" : id_page }
	
def delete ( liwe, id_page ):
	"""
	:INPUT:
		- id_page:              SAFE_NUMBER

	:PERMS:
		- create:		With this permission you can create/modify
	"""

	tp = PageManager ( liwe )
	tp.delete ( id_page )

	return { "status": 'ok' }
